koltyakov / generator-sppp

🐾 SP Pull-n-Push - Yeoman generator for SharePoint client-side applications
MIT License
64 stars 12 forks source link

cannot find module 'node-sass' #28

Closed kunalkankariya closed 5 years ago

kunalkankariya commented 5 years ago

After scaffolding the project using 'yo sppp' and running the command npm run config, it threw an error Error: Cannot find module 'sp-build-tasks'. Assuming that the devDependencies were missing I ran the command " npm install --only=dev " .

I get another error now, "Cannot find module 'node-sass'" . What am I missing here?

koltyakov commented 5 years ago

You should run npm install, inside project's folder. However, dependencies are restored automatically when you scaffold a project. I suggest scaffold a projects with npx -p yo -p generator-sppp -c 'yo sppp' and check that during the process there were no errors.

After scaffolding your package.json should look like this and ready for automation command righ away:

image

kunalkankariya commented 5 years ago

When I try to use NPX I get this error

λ npx -p yo -c 'yo spp' Command failed: C:\"Program Files"\nodejs\node.exe "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" run env --parseable npm ERR! path d:\KK\package.json npm ERR! code ENOENT npm ERR! errno -4058 npm ERR! syscall open npm ERR! enoent ENOENT: no such file or directory, open 'd:\KK\package.json' npm ERR! enoent This is related to npm not being able to find a file. npm ERR! enoent

NPX versions is 6.4.1

koltyakov commented 5 years ago

You put 2 errors into the command :D, compare these:

Can you see some difference?

kunalkankariya commented 5 years ago

Apologies, but I get the same error. I used the command above to test, but I get the same error when running npx -p yo -p generator-sppp -c 'yo sppp'

kunalkankariya commented 5 years ago

Some more details

I found out that someone had faced this issue earlier with npx and solution was to add a package.json file in the parent directory, which I did and it did work. ( Reference : [(https://github.com/zkat/npx/issues/72)])

However, I thought of upgrading NPX to see if issues were fixed in the latest version. After doing a npx@latest install, the command line still showed the older version being used. The newer version installed in the node_modules folder wasn't being picked. Again, I followed this issue ( to remove the npx files in the node folder and now the new version 10.2.0 was in use.

I tried running the command npx -p yo -p generator-sppp -c 'yo sppp' this would run and throw the error

''yo' is not recognized as an internal or external command, operable program or batch file.

I replaced the single quotes to double quotes

npx -p yo -p generator-sppp -c "yo sppp"

and the command does run and starts installing dependencies, it now throws error while downloading the node-sass binary

Cannot download "https://github.com/sass/node-sass/releases/download/v4.12.0/win32-x64-64_binding.node":

connect ETIMEDOUT 192.30.253.112:6080

koltyakov commented 5 years ago

Cannot download "https://github.com/sass/node-sass/releases/download/v4.12.0/win32-x64-64_binding.node": connect ETIMEDOUT 192.30.253.112:6080

Looks that you're are behind the proxy and some CLI tools can't reach the internet.

kunalkankariya commented 5 years ago

Yes I guessed so and I started the whole thing again after setting up the proxy. It works now.

I wonder why others didn't face the issues I faced above, with npx and the double quotes.

kunalkankariya commented 5 years ago

@koltyakov While pushing files to SP (publish), if my masterpage library has a mandatory Title column then the push fails. Where do I make changes to handle such issues without making Title optional in SP.

Also, where are the gulp tasks, I don't see them in the gulpfile.js. Thank you!

koltyakov commented 5 years ago

Separate topics as separate issues, please. Thanks!