npm install cannot find module
Closed this issue · 5 comments
After importing as described, cannot resolve the module.
I also created a plan new project with Yeoman generator. I generated an SPFX Application Customizer, and added this module.
Error while importing on top of my .ts file:
import { Navigation } from 'spfx-navigation';
[11:16:14] Error - [tsc] src/extensions/testabc/TestabcApplicationCustomizer.ts(10,28): error TS2307: Cannot find module 'spfx-navigation'.
My package.json:
{
"name": "test-navigation",
"version": "0.0.1",
"private": true,
"main": "lib/index.js",
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"build": "gulp bundle",
"clean": "gulp clean",
"test": "gulp test"
},
"dependencies": {
"@microsoft/decorators": "1.10.0",
"@microsoft/sp-application-base": "1.10.0",
"@microsoft/sp-core-library": "1.10.0",
"@microsoft/sp-dialog": "1.10.0",
"@types/es6-promise": "0.0.33",
"@types/webpack-env": "1.13.1",
"spfx-navigation": "1.2.1"
},
"devDependencies": {
"@microsoft/sp-build-web": "1.10.0",
"@microsoft/sp-tslint-rules": "1.10.0",
"@microsoft/sp-module-interfaces": "1.10.0",
"@microsoft/sp-webpart-workbench": "1.10.0",
"@microsoft/rush-stack-compiler-3.3": "0.3.5",
"gulp": "~3.9.1",
"@types/chai": "3.4.34",
"@types/mocha": "2.2.38",
"ajv": "~5.2.2"
}
}
This has nothing to do with the package, but with a package that doesn't seem to be installed correctly. Can you check if the package is available in the node_modules folder?
Ok, I see the issue, for some reason the lib
folder has been excluded from the package. I'll verify this.
It seems a build action was missing from the Github workflow. 1.2.2
version is out and it should be fixed. Thanks for opening the issue.
You’re welcome. Thanks for your quick response!