edison xue
edison xue

Reputation: 1331

I've install the node_modules. Why is there still "no such file or directory"?

In my country, I use the mirroring of npm. I have run

npm install 

and get the node_modules directory. But when I try to use

npm run serve

it causes an error and says

[10:30:26] Error: ENOENT: no such file or directory, scandir 'C:\Users\acer\personal_profile\wittr\node_modules.3.13.1@node-sass\vendor'

[10:30:26] 'serve' errored after 35 ms

[10:30:26] Error in plugin 'run-sequence(css)'

Message:ENOENT:no such file or directory,scandir'C:\Users\acer\personal_profile\wittr\node_modules.3.13.1@node-sass\vendor'

Details: errno: -4058

code: ENOENT

syscall: scandir

path: C:\Users\acer\personal_profile\wittr\node_modules.3.13.1@node-sass\vendor

Stack:Error: ENOENT: no such file or directory, scandir >'C:\Users\acer\personal_profile\wittr\node_modules.3.13.1@node-sass\vendor'

I'm very confused with that, I have installed the node_module, but why causes such an error? Is it something wrong with mirroring? But it says the mirroring is very reliable.

I am not a native speaker. Thank you very much for correcting my expression errors.

Upvotes: 1

Views: 9277

Answers (1)

Nicholas Lu
Nicholas Lu

Reputation: 1893

 npm rebuild node-sass 

would solve your problem

This commonly happens in CI systems because they'll typically run npm install with the default OS Node. Later in their script they'll switch a new version of Node. Native extension are compiled against the version of Node that npm was using during install. This means the new Node cannot see the extension built during install.

In this case, running npm install again doesn't fix the issue because npm thinks it is installed. This is why you must run npm rebuild node-sass.

Upvotes: 2

Related Questions